package boot3.mapper;

import boot3.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    //根据student_id返回指定的学生
    @Select("select * from student where student_id=#{student_id}")
    public Student getStudentById(String student_id);
    //根据学生的ID修改某条学生的信息
    @Update("update student set ${item} = #{value} where student_id=#{student_id}")
    public Boolean updateStudent(String student_id,String item, String value);
    //获取学院所有的学生信息
    @Select("select * from student where college=#{college}")
    public List<Student> getStudentByCollege(String college);
    //获取所有的学院
    @Select("select college from student group by college")
    public List<String> findCollege();
    //新加学生
    @Insert("insert student value(#{student_id},#{student_name},#{student_sex},#{college},#{major},#{interest},#{search_exper})")
    public Boolean addStudent(Student student);
    //根据Id删除学生
    @Delete("delete from student where student_id=#{student_id}")
    public Boolean deleteStudent(String student_id);
}
